<?php
namespace Org\Util;

class AdminController extends \Think\Controller {

	/**
	 * 权限验证时载入对应的用户类型
	 * 'MODULE_NAME'=>'SESSION中存储的key'
	 */
	protected $authorityType = [
		'Admin' => '管理员',
		'Guider' => '导游',
		'Club' => '旅社',
		'Shop' => '商家',
	];

	/**
	 * 初始化操作
	 */
	protected function _initialize() {
		$model = D(CONTROLLER_NAME);

		//权限验证
		if ($model->notAuthority === false) {
			//所有action都需要权限验证
			if (!session($this->authorityType[MODULE_NAME])) {
				$this->error('请先登录!', U('Index/index'));
			}
		} elseif ($model->notAuthority === true) {
			//所有action都不需要权限验证
		} elseif (is_array($model->notAuthority)) {
			//array中的action不需要权限验证，其余需要。
			if (!in_array(ACTION_NAME, $model->notAuthority)) {
				if (!session($this->authorityType[MODULE_NAME])) {
					$this->error('请先登录!', U('Index/index'));
				}
			}
		}

		//admin信息
		$admin = session('管理员');
		$this->assign('admin', $admin);

		//系统信息
		$system = D('System')->find();
		$this->assign('system', $system);

		//针对116补丁,全部迁移完成后即可恢复
		if ($model->modelName == '') {
			$modelName = $this->modelName;
		} else {
			$modelName = $model->modelName;
		}
		if ($model->modelIcon == '') {
			$modelIcon = $this->modelIcon;
		} else {
			$modelIcon = $model->modelIcon;
		}
		//前端页面基本信息渲染
		$this->assign('modelName', $modelName);
		$this->assign('modelIcon', $modelIcon);
		$this->assign('crumbsMap', $this->crumbsMap);
		/*
		//前端页面基本信息渲染
		$this->assign('modelName', $model->modelName);
		$this->assign('modelIcon', $model->modelIcon);
		$this->assign('crumbsMap', $this->crumbsMap);
		*/

		//页面渲染
		$notAutoGenerate = C('NOT_AUTO_GENERATE');
		if ($notAutoGenerate === false) {
			//所有页面都生成
			$this->generateView();
		} elseif (C('AUTO_GENERATE') === true) {
			//所有页面都不生成
		} elseif (is_array($notAutoGenerate)) {
			//取到不需要生成的action给到generateView就行
			//判断当前module
			if (!array_key_exists(MODULE_NAME, $notAutoGenerate)) {
				//当前module不在不生成的列表里,需要正常生成
				$this->generateView();
			} else if (count($notAutoGenerate[MODULE_NAME]) != 0) {
				//当前module下指定的controller不生成
				//判断当前controller
				$notAutoGenerateController = $notAutoGenerate[MODULE_NAME];
				if (!array_key_exists(CONTROLLER_NAME, $notAutoGenerateController)) {
					//当前controller不在不生成的列表里,需要正常生成
					$this->generateView();
				} else if (count($notAutoGenerateController[CONTROLLER_NAME]) != 0) {
					//当前controller下指定的action不生成
					$this->generateView($notAutoGenerateController[CONTROLLER_NAME]);
				}

			}			
		}
	}

	/**
	 * 生成当前controller下指定action的view
	 * @params $notGenerateActions=''时生成所有页面
	 * @params $notGenerateActions=['list', 'update']时生成除了数组中的action以外的view
	 */
	public function generateView($notGenerateActions = '') {
		//CREATE+UPDATE
		$updateView = $this->updateView();
		//LIST
		$searchView = $this->searchView();
		$tableView = $this->tableView();
		$listView = $searchView . $tableView;
		//DETAIL
		$detailView = $this->detailView();
		//IMPORT
		$importView = $this->importView();
		mkdir('./App/' . MODULE_NAME . '/View/' . CONTROLLER_NAME . '/');
		//生成所有的页面
		if ($notGenerateActions == '') {
			file_put_contents('./App/' . MODULE_NAME . '/View/' . CONTROLLER_NAME . '/list.html', $listView);
			file_put_contents('./App/' . MODULE_NAME . '/View/' . CONTROLLER_NAME . '/update.html', $updateView);
			file_put_contents('./App/' . MODULE_NAME . '/View/' . CONTROLLER_NAME . '/detail.html', $detailView);
			file_put_contents('./App/' . MODULE_NAME . '/View/' . CONTROLLER_NAME . '/import.html', $importView);
		}
		//$notGenerateActions中有的不生成
		if (!in_array('list', $notGenerateActions)) {
			file_put_contents('./App/' . MODULE_NAME . '/View/' . CONTROLLER_NAME . '/list.html', $listView);
		}
		if (!in_array('update', $notGenerateActions)) {
			file_put_contents('./App/' . MODULE_NAME . '/View/' . CONTROLLER_NAME . '/update.html', $updateView);
		}
		if (!in_array('detail', $notGenerateActions)) {
			file_put_contents('./App/' . MODULE_NAME . '/View/' . CONTROLLER_NAME . '/detail.html', $detailView);
		}
		if (!in_array('import', $notGenerateActions)) {
			file_put_contents('./App/' . MODULE_NAME . '/View/' . CONTROLLER_NAME . '/import.html', $importView);
		}
	}

	//CREATE
	/**
	 * create之前要做的事情
	 * 在子类中覆盖即可执行相关动作
	 */
	public function interfaceBeforeCreate() {
	}

	/**
	 * create之后要做的事情
	 * 在子类中覆盖即可执行相关动作
	 */
	public function interfaceAfterCreate($id) {
	}

	/**
	 * 典型create操作
	 */
	public function create() {


		if (IS_POST) {
			
			$this->interfaceBeforeCreate($newId);
			
			$model = D(CONTROLLER_NAME);
			//处理文件上传
			if (count($_FILES) !== 0) {
				$upload = new \Think\Upload();
				$upload->maxSize = 0;
				$upload->rootPath = './Public/file/'; 
				$upload->savePath = '';
				$upload->autoSub = false;
				$info = $upload->upload();
				if (!$info) {
					$this->error($upload->getError());
					return false;
				}
				foreach ($_FILES as $field => $file) {
					$_POST[$field] = $info[$field]['savename'];
				}
			}
			if (!$model->create()) {
				$this->error($model->getError());
				return false;
			}
			$newId = $model->add();

			$this->interfaceAfterCreate($newId);
			$this->success('新增成功!', U('list'));
		}
		$this->display('update');
	}

	//DELETE
	
	/**
	 * delete之前要做的事情
	 * 在子类中覆盖即可执行相关动作
	 */
	public function interfaceBeforeDelete($id) {
	}
	/**
	 * delete之后要做的事情
	 * 在子类中覆盖即可执行相关动作
	 */
	public function interfaceAfterDelete($id) {
	}

	/**
	 * 典型delete操作
	 */
	public function delete() {
		if (IS_POST) {
			$this->interfaceBeforeDelete(I('post.id'));
			$model = D(CONTROLLER_NAME);
			//删除文件
			foreach ($model->fieldMap as $field => $param) {
				if ($param['type'] === 'file') {
					$deleteModels = $model->select(I('post.id'));
					foreach ($deleteModels as $deleteModel) {
						unlink('./Public/file/' . $deleteModel[$field]);
					}
				}
			}
			$model->delete(I('post.id'));
			$this->interfaceAfterDelete(I('post.id'));
			$data['info'] = '删除成功!';
			$data['status'] = 1;
			$this->ajaxReturn($data, 'JSON');
		}
	}

	//UPDATE
	
	/**
	 * update之前要做的事情
	 * 在子类中覆盖即可执行相关动作
	 */
	public function interfaceBeforeUpdate($id) {
	}
	/**
	 * update之后要做的事情
	 * 在子类中覆盖即可执行相关动作
	 */
	public function interfaceAfterUpdate($id) {
	}

	/**
	 * 典型update操作
	 */
	public function update($id = 0, $param = []) {
	
		$model = D(CONTROLLER_NAME);
		if (IS_POST) {
			$this->interfaceBeforeUpdate($id);
			$_POST['id'] = $id;
			if (count($_FILES) !== 0) {
				$upload = new \Think\Upload();
				$upload->maxSize = 0; 
				$upload->rootPath = './Public/file/';
				$upload->savePath = '';
				$upload->autoSub = false;
				$info = $upload->upload();
				if ($info) {
					//上传成功，删除原有文件
					foreach ($_FILES as $field => $file) {
						$_POST[$field] = $info[$field]['savename'];
						if ($info[$field]['savename']) {
							if (isset($id)) {
								$modelTemp = $model->find($id);
								unlink('./Public/file/' . $modelTemp[$field]);
							}
						}
					}
				}
			}
			if (!$model->create($_POST)) {
				$this->error($model->getError());
				return false;
			}

			$model->save();
			$this->interfaceAfterUpdate($id);
			if (!$param['redirect']) {
				$this->success('修改成功!', U('list'));
			} else {
				$this->success('修改成功!', $param['redirect']);
			}
		}
		//展示页面
		$modelData = $model->getById($id);
		if (!$modelData) {
			$this->error('非法操作!');
			return false;
		}
		$this->assign('model', $modelData);
		$this->display();
	}

	//LIST
	/**
	 * 典型list操作
	 */
	public function list() {
		$this->page();
		$this->display();
	}

	/**
	 * 分页数据渲染
	 * @params array $searchMap 寻找元素时的条件,默认为$_GET['searchMap']的值
	 */
	public function page() {
		$searchMap = $this->handleSearchMap($_GET["searchMap"]);
		$model = D(CONTROLLER_NAME);
		$count = $model->where($searchMap)->count();
		$page = new \Think\AdminPage($count, C('PAGE_NUM'));
		$show = $page->show();
		$list = $model->where($searchMap)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
		//dump($model->getLastsql());die;
		$this->assign('list', $list);
		$this->assign('page', $show);
	}

	//DETAIL
	/**
	 * 典型detail操作
	 */
	public function detail($id = 0) {
		$model = D(CONTROLLER_NAME);
		$detail = $model->find($id);
		$this->assign('detail', $detail);
		$this->display('detail');
	}

	//EXPORT
	/**
	 * 典型export操作
	 * @params array $searchMap 寻找元素时的条件,默认为$_GET['searchMap']的值
	 */
	public function export() {

		$searchMap = $this->handleSearchMap(I('get.searchMap'));
		$model = D(CONTROLLER_NAME);
		$excelCell = [];
		$fieldStr = '';
		foreach ($model->fieldMap as $field => $param) {
			if (($param['excel'] !== false) && ($param['excel'] !== 'import')) {
				$excelCell[] = [$field, $param['name']];
				$fieldStr .= $field . ',';
			}
		}

		$fieldStr = substr($fieldStr, 0, strlen($fieldStr) - 1);
		$excelData = $model->where($searchMap)->field($fieldStr)->order('id')->select();
		foreach ($excelData as $k => $v) {
			foreach ($v as $k1 => $v1) {
				$modelExcelConf = $model->fieldMap[$k1]['excel'];
				if (($modelExcelConf !== false) && ($modelExcelConf !== 'import')) {
					$excelData[$k][$k1] = $this->exportValueHandle($k1, $v1);
				}
			}
		}

		if ((count($excelData) == 0)||(count($excelCell) == 0)) {
			$this->error('无数据可导出,请增加数据或修改筛选条件!');
		}
		\exportExcel($model->modelName, $excelCell, $excelData);
	}

	/**
	 * 导出excel指定类型值处理
	 * @params $field : 字段
	 * @params $value : 需要处理的值
	 * @return $retuanValue : 处理完成的值
	 */
	public function exportValueHandle($field = '', $value = '') {
		$model = D(CONTROLLER_NAME);
		$param = $model->fieldMap[$field];
		$type = $param['type'];
		$retuanValue = $value;
		switch ($type) {
		case 'file':
			break;
		case 'foreign':
			$foreignContent = $param['content'];
			$foreignInfo = explode(',', $foreignContent);
			$retuanValue = D(ucfirst($foreignInfo[0]))->where([$foreignInfo[1] => $value])->find()[$foreignInfo[2]];
			break;
		case 'date':
			$retuanValue = date('Y-m-d', $value);
			break;
		case 'datetime':
			$retuanValue = date('Y-m-d H:i:s', $value);
			break;
		}
		return $retuanValue;
	}

	//IMPORT
	/**
	 * 典型import操作
	 * 无任何定制化需求的model可以直接复用本action
	 * @params array $searchMap 寻找元素时的条件,默认为$_GET['searchMap']的值
	 */
	public function import() {
		if (IS_POST) {
			if (isset($_FILES["import"]) && ($_FILES["import"]["error"] == 0)) {
				$model = D(CONTROLLER_NAME);
				$excelCell = [];
				foreach ($model->fieldMap as $field => $param) {
					if (($param['excel'] !== false) && ($param['excel'] !== 'export')) {
						$excelCell[] = $field;
					}
				}
				$result = \importExecl($_FILES["import"]["tmp_name"]);
				if ($result["error"] == 1) {
					$excelData = $result["data"][0]["Content"];
					foreach ($excelData as $k => $v) {
						if ($k <= 2) {
							//跳过表头
							continue;
						}
						$data = [];
						foreach ($excelCell as $i => $field) {
							$data[$field] = $this->importValueHandle($field, $v[$i]);
						}
						if (!($model->create($data) && $model->add())) {
							$this->error($model->getError());
						}
					}
				}
			}
			$this->success('导入成功!', U(CONTROLLER_NAME . '/list'));
		}
		$this->display();
	}

	/**
	 * 导入excel指定类型值处理
	 * @params $field : 字段
	 * @params $value : 需要处理的值
	 * @return $retuanValue : 处理完成的值
	 */
	public function importValueHandle($field = '', $value = '') {
		$model = D(CONTROLLER_NAME);
		$param = $model->fieldMap[$field];
		$type = $param['type'];
		$retuanValue = $value;
		switch ($type) {
		case 'file':
			break;
		case 'foreign':
			$foreignContent = $param['content'];
			$foreignInfo = explode(',', $foreignContent);
			$retuanValue = D(ucfirst($foreignInfo[0]))->where([$foreignInfo[2] => $value])->find()[$foreignInfo[1]];
			break;
		case 'date':
			//$retuanValue = strtotime($value);
			break;
		case 'datetime':
			//$retuanValue = strtotime($value);
			break;
		}
		return $retuanValue;
	}

	/**
	 * 对searchMap中需要特殊处理的值进行处理
	 * @params $searchMap : 待处理的searchMap
	 * @return $searchMap : 处理完成的searchMap
	 */
	public function handleSearchMap($searchMap = '') {
		$searchMap = array_filter($searchMap);
		$model = D(CONTROLLER_NAME);
		
		foreach ($searchMap as $field => $value) {
			if (strstr($field, 'Start')) {
				//时间筛选,起止范围,需要特殊处理
				$startField = $field;
				$endField = str_replace("Start", "End", $field);
				$field = str_replace('Start', '', $field); //此后的field为真实field
				$startTime = $searchMap[$startField];
				$endTime = $searchMap[$endField];
				unset($searchMap[$startField]);
				unset($searchMap[$endField]);
				$searchMap[$field] = ['between', [strtotime($startTime), strtotime($endTime)]];
			}
			$param = $model->fieldMap[$field];
			if (($param['type'] == 'foreign') && (explode(',', $param['content'])[3] == 'input')) {
				//input类型的外键，需要转换成id
				if ($searchMap[$field]) {
					$foreignArr = explode(',', $param['content']);
					$retArr = D(ucfirst($foreignArr[0]))->where([$foreignArr[2] => $searchMap[$field]])->select();
					$retStr = '';
					foreach ($retArr as $key => $value) {
						$retStr .= $value[$foreignArr[1]] . ',';
					}
					$retStr = rtrim($retStr, ",");
					$searchMap[$field] = ['IN', $retStr];
				}
			}
		}
		return $searchMap;
	}

	//VIEW
	//CREATE+UPDATE
	public function updateView() {
		$model = D(CONTROLLER_NAME);
		//updateStart
		$updateView = $this->updateStart($model);
		//updateContent
		if (count($model->fieldMap) !== 0) {
			foreach ($model->fieldMap as $field => $param) {
				$updateView .= $this->updateOption($field, $param);
			}
		}
		//updateEnd
		$updateView .= $this->updateEnd();
		return $updateView;
	}
	//LIST
	/**
	 * list页面搜索部分
	 */
	public function searchView() {
		$model = D(CONTROLLER_NAME);
		//searchStart
		$searchView = $this->searchStart();
		//searchContent
		if (count($model->fieldMap) !== 0) {
			foreach ($model->fieldMap as $field => $param) {
				$searchView .= $this->searchOption($field, $param);
			}
		}
		//searchEnd
		$searchView .= $this->searchEnd();
		return $searchView;
	}

	/**
	 * list页面核心表格
	 */
	public function tableView() {
		$model = D(CONTROLLER_NAME);
		//tableStart
		$tableView = $this->tableStart($model);
		//tableContent
		if (count($model->fieldMap) !== 0) {
			foreach ($model->fieldMap as $field => $param) {
				$tableView .= $this->tableOption($field, $param);
			}
		}
		//tableEnd
		$tableView .= $this->tableEnd($model);
		return $tableView;
	}
	//DETAIL
	public function detailView() {
		$model = D(CONTROLLER_NAME);
		//detailStart
		$detailView = $this->detailStart();
		//detailContent
		if (count($model->fieldMap) !== 0) {
			foreach ($model->fieldMap as $field => $param) {
				$detailView .= $this->detailOption($field, $param);
			}
		}
		//detailEnd
		$detailView .= $this->detailEnd();
		return $detailView;
	}
	//IMPORT
	public function importView() {
		$model = D(CONTROLLER_NAME);
		//importStart
		$importView = $this->updateStart($model);
		$importView .= $this->importContent();
		//importEnd
		$importView .= $this->updateEnd();
		return $importView;
	}

	//以下为具体实现
	
	/**
	 * model的中文名称，需要在子类中覆盖
	 */
	protected $modelName = '';

	/**
	 * model的icon，需要在子类中覆盖
	 */
	protected $modelIcon = '';

	/**
	 * 面包屑导航map
	 * 用法$crumbsMap[ACTION_NAME]
	 */
	protected $crumbsMap = [
		'list' => '列表',
		'create' => '新增',
		'update' => '修改',
		'index' => '概况',
		'detail' => '详情',
		'import' => '导入',
	];

	//LIST
	/**
	 * searchInput数量
	 */
	protected $searchNum = 0;

	/**
	 * searchInputMove的值map
	 */
	protected $searchMoveMap = [
		0 => 10,
		1 => 7,
		2 => 4,
		3 => 1,
	];

	public function searchOption($field, $param) {
		if ($param['search'] === true) {
			if (($param['type'] == 'password') || ($param['type'] == 'ueditor') || ($param['type'] == 'file') || ($param['type'] == 'textarea')) {
				$param['type'] = 'input';
			}
			$searchOption = 'search' . ucfirst($param['type']);
			$searchView = $this->$searchOption($field, $param);
			return $searchView;
		} else {
			return '';
		}
	}

	//LIST-SEARCH
	public function searchStart() {
		$startView = '
<include file="Public/ace_header" />
<div class="row">
    <div class="col-xs-12">
        <div class="row hidden-480 search">
            <form id="search-form">';
		return $startView;
	}

	public function searchSelect($field, $param) {
		$this->searchNum++;
		//option
		$optionView = '
                        <option value="" class="search-select-default-option">' . $param['name'] . '</option>';
		$options = explode(',', $param['content']);
		foreach ($options as $option) {
			$optionView .= '
                        <option value="' . $option . '" <if condition ="$_GET[searchMap][' . $field . '] eq \'' . $option . '\'"> selected </if>>' . $option . '</option>';
		}
		//select
		$selectView = '
                <div class="col-md-3 search-input-div">
                    <select name="searchMap[' . $field . ']" id="' . $field . '" class="width-100 search-select">' . $optionView . '
                    </select>
                </div>';
		return $selectView;
	}
	public function searchForeign($field, $param) {
		$this->searchNum++;
		$foreignArr = explode(',', $param['content']);
		if ($foreignArr[3] === 'select') {
			$optionView = '
                        <option value="" class="search-select-default-option">' . $param['name'] . '</option>
                        <php>$foriegnModel = D(\'' . $foreignArr[0] . '\')->select();</php>
                        <volist name="foriegnModel" id="vo">
                        <option value="{$vo[\'' . $foreignArr[1] . '\']}" <if condition ="$_GET[\'searchMap\'][\'' . $field . '\'] eq $vo[\'' . $foreignArr[1] . '\']"> selected </if>>{$vo[\'' . $foreignArr[2] . '\']}</option>
                        </volist>';
			$foreignView = '
                <div class="col-md-3 search-input-div">
                    <select name="searchMap[' . $field . ']" id="' . $field . '" class="width-100 search-select">' . $optionView . '
                    </select>
                </div>';
			return $foreignView;
		} elseif ($foreignArr[3] === 'input') {
			$foreignView = '
                <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="searchMap[' . $field . ']" id="' . $field . '" value="{$_GET[searchMap][' . $field . ']}" placeholder="' . $param['name'] . '"/>
                </div>';
			return $foreignView;
		}
	}

	public function searchDate($field, $param) {
		$this->searchNum++;
		$this->searchNum++;
		//日期/日期时间，用范围查询
		$dateView = '
                <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="searchMap[' . $field . 'Start]" id="' . $field . 'Start" value="{$_GET[searchMap][' . $field . 'Start]}" placeholder="' . $param['name'] . '开始时间" onClick="WdatePicker()" readonly="" onChange="' . $field . 'StartChange()"/>
                </div>
                <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="searchMap[' . $field . 'End]" id="' . $field . 'End" value="{$_GET[searchMap][' . $field . 'End]}" placeholder="' . $param['name'] . '结束时间" onClick="WdatePicker()" readonly="" onChange="' . $field . 'EndChange()"/>
                </div>
                <script>
                    function ' . $field . 'StartChange() {
                        var ' . $field . 'End = $("#' . $field . 'End").val();
                        if (' . $field . 'End != "") {
                            var ' . $field . 'Start = $("#' . $field . 'Start").val();
                            if (' . $field . 'End < ' . $field . 'Start) {
                                alert("起始时间必须早于结束时间!");
                                $("#' . $field . 'Start").val("");
                            }
                        }
                    }
                    function ' . $field . 'EndChange() {
                        var ' . $field . 'Start = $("#' . $field . 'Start").val();
                        if (' . $field . 'Start != "") {
                            var ' . $field . 'End = $("#' . $field . 'End").val();
                             if (' . $field . 'Start > ' . $field . 'End) {
                                alert("结束时间必须晚于起始时间!");
                                $("#' . $field . 'End").val("");
                            }
                        }
                    }
                    </script>';
		return $dateView;
	}

	public function searchDatetime($field, $param) {
		$this->searchNum++;
		$this->searchNum++;
		//日期/日期时间，用范围查询
		$datetimeView = '
                <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="searchMap[' . $field . 'Start]" id="' . $field . 'Start" value="{$_GET[searchMap][' . $field . 'Start]}" placeholder="' . $param['name'] . '开始时间" onClick="WdatePicker({dateFmt:\'yyyy-MM-dd HH:mm:ss\'})" readonly="" onChange="' . $field . 'StartChange()"/>
                </div>
                <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="searchMap[' . $field . 'End]" id="' . $field . 'End" value="{$_GET[searchMap][' . $field . 'End]}" placeholder="' . $param['name'] . '结束时间" onClick="WdatePicker({dateFmt:\'yyyy-MM-dd HH:mm:ss\'})" readonly="" onChange="' . $field . 'EndChange()"/>
                </div>
                <script>
                    function ' . $field . 'StartChange() {
                        var ' . $field . 'End = $("#' . $field . 'End").val();
                        if (' . $field . 'End != "") {
                            var ' . $field . 'Start = $("#' . $field . 'Start").val();
                            if (' . $field . 'End < ' . $field . 'Start) {
                                alert("起始时间必须早于结束时间!");
                                $("#' . $field . 'Start").val("");
                            }
                        }
                    }
                    function ' . $field . 'EndChange() {
                        var ' . $field . 'Start = $("#' . $field . 'Start").val();
                        if (' . $field . 'Start != "") {
                            var ' . $field . 'End = $("#' . $field . 'End").val();
                             if (' . $field . 'Start > ' . $field . 'End) {
                                alert("结束时间必须晚于起始时间!");
                                $("#' . $field . 'End").val("");
                            }
                        }
                    }
                    </script>';
		return $datetimeView;
	}

	public function searchInput($field, $param) {
		$this->searchNum++;
		$inputView = '
                <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="searchMap[' . $field . ']" id="' . $field . '" value="{$_GET[searchMap][' . $field . ']}" placeholder="' . $param['name'] . '"/>
                </div>';
		return $inputView;

	}

	public function searchEnd() {
		$searchMove = $this->searchMoveMap[$this->searchNum % 4] - 1;
		$endView = '
                <div class="col-md-3 col-md-offset-' . $searchMove . ' center search-input-div">';
		if ($this->searchNum !== 0) {
			$endView .= '
                    <button type="submit" class="btn btn-success btn-xs">查询</button>
                    <button class="btn btn-warning btn-xs" type="button" href="#" onclick="clearFind()">清空</button>';
		}
		$model = D(CONTROLLER_NAME);
		if (($model->excel === true) || ($model->excel === 'import')) {
			$endView .= '
                    <a class="btn btn-purple btn-xs" href="{:U(import)}">导入</a>';
		}
		if (($model->excel === true) || ($model->excel === 'export')) {
			$endView .= '
                    <a class="btn btn-pink btn-xs" id="export-btn" href="{:U(export)}" onclick="return exportExcel()">导出</a>';
		}
		if ($model->delete !== false) {
			$endView .= '
                    <button class="btn btn-danger btn-xs" type="button" href="javascript:void(0);" id="delall">删除</button>';
		}
		$endView .= '
                </div>
            </form>
        </div>';
		return $endView;
	}



	public function tableDate($field, $param) {
		$dateView = '
                        <td ' . $param['class'] . '><if condition="$vo[' . $field . '] neq 0">{$vo[' . $field . ']|default=\'\'|date="Y-m-d",###}</if></td>';
		return $dateView;
	}

	public function tableDatetime($field, $param) {
		$datetimeView = '
                        <td ' . $param['class'] . '><if condition="$vo[' . $field . '] neq 0">{$vo[' . $field . ']|default=\'\'|date="Y-m-d H:i:s",###}</if></td>';
		return $datetimeView;
	}

	public function tableUeditor($field, $param) {
		$ueditorView = '
                        <td ' . $param['class'] . '>{$vo[' . $field . ']|html_entity_decode}</td>';
		return $ueditorView;
	}

	public function tableForeign($field, $param) {
		$foreignArr = explode(',', $param['content']);
		$foreignView = '
                        <td ' . $param['class'] . '><php> echo D("' . ucfirst($foreignArr[0]) . '")->find($vo["' . $field . '"])["' . $foreignArr[2] . '"];</php></td>';
		return $foreignView;
	}

	public function tableInput($field, $param) {
		$inputView = '
                        <td ' . $param['class'] . '>{$vo[' . $field . ']}</td>';
		return $inputView;
	}

	public function tableFile($field, $param) {
		//file的content img,100,200 //图片/文件 宽 高
		$fileStr = '{$vo[' . $field . ']}'; //img类型，update时显示图片,create时不显示
		$fileContent = explode(',', $param['content']);
		if (($fileContent[0] == 'img') OR (!$fileContent[0])) {
			if (!$fileContent[1]) {
				$imgWidth = "120";
			} else {
				$imgWidth = $fileContent[1];
			}
			if (!$fileContent[2]) {
				$imgHeight = "60";
			} else {
				$imgHeight = $fileContent[2];
			}
			$fileStr = '<img src="__PUBLIC__/file/{$vo[\''.$field.'\']}" width="'.$imgWidth.'" height="'.$imgHeight.'" />';
		}
		$inputView = '
                        <td ' . $param['class'] . '>'.$fileStr.'</td>';
		return $inputView;
	}


	public function tableOption($field, $param) {
		if ($param['list'] === false) {
		} else if ($param['list_specify'] != '') {
			$tableView = $param['list_specify'];
		} else {
			if (($param['type'] == 'password') || ($param['type'] == 'select') || ($param['type'] == 'textarea')) {
				$param['type'] = 'input';
			}
			$tableOption = 'table' . ucfirst($param['type']);
			//响应式区分，只在手机上显示;只在电脑上显示.
			if ($param['list'] === true) {
				$classStr = 'class="center"';
			} elseif ($param['list'] == 'pc') {
				$classStr = 'class="center visible-md visible-lg hidden-sm hidden-xs"';
			} elseif ($param['list'] == 'wap') {
				$classStr = 'class="center visible-xs visible-sm hidden-md hidden-lg"';
			}
			$param['class'] = $classStr;
			$tableView = $this->$tableOption($field, $param);
		}
		return $tableView;
	}

	public function tableStart($model) {
		$startView = '
        <div class="table-responsive">
            <table class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th class="center">
                            <label>
                                <input type="checkbox" class="ace" id="checkall"/>
                                <span class="lbl"></span>
                            </label>
                        </th>';
		foreach ($model->fieldMap as $field => $param) {
			if ($param['list'] !== false) {
				if ($param['list'] === true) {
					$classStr = 'class="center"';
				} elseif ($param['list'] == 'pc') {
					$classStr = 'class="center visible-md visible-lg hidden-sm hidden-xs"';
				} elseif ($param['list'] == 'wap') {
					$classStr = 'class="center visible-xs visible-sm hidden-md hidden-lg"';
				}
				$startView .= '
                    <th ' . $classStr . '>' . $param['name'] . '</th>';
			}
		}
		$startView .= '
                        <th class="center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <volist name="list" id="vo">
                    <tr>
                        <td class="center">
                            <label>
                                <input type="checkbox" class="ace" name="chkid" value="{$vo[\'id\']}"/>
                                <span class="lbl"></span>
                            </label>
                        </td>';
		return $startView;
	}

	/**
	 * 增加table里的手机操作按钮用,在controller里覆盖
	 * return String
	 */
	public function wapTableOpeationButton() {
		return '';
	}

	/**
	 * 增加table里的操作按钮用,在controller里覆盖
	 * return String
	 */
	public function tableOpeationButton() {
		return '';
	}

	public function tableEnd($model) {
		$deleteButton = '';
		$wapDeleteButton = '';
		$updateButton = '';
		$wapUpdateButton = '';
		$detailButton = '';
		$wapDetailButton = '';
		if ($model->delete !== false) {
			$deleteButton = '
                                    <a class="delete-btn" id="{$vo[\'id\']}" >
                                        <button class="btn btn-xs btn-danger" style="border: 1px;">
                                            <i class="icon-trash"></i>
                                        </button>
                                    </a>';
			$wapDeleteButton = '
                                            <li>
                                                <a class="delete-btn" id="{$vo[\'id\']}">
                                                    <span class="red">
                                                        <i class="icon-trash bigger-120"></i>
                                                    </span>
                                                </a>
                                            </li>';

		}
		if ($model->update !== false) {
			$updateButton = '
                                    <a href="{:U(update, [\'id\'=>$vo[\'id\']])}">
                                        <button class="btn btn-xs btn-info" style="border: 1px;">
                                            <i class="icon-edit" style="margin-right: 0px;"></i>
                                        </button>
                                    </a>';
			$wapUpdateButton = '
                                            <li>
                                                <a href="{:U(update, [\'id\'=>$vo[\'id\']])}" class="tooltip-success" data-rel="tooltip" title="Edit">
                                                    <span class="green">
                                                        <i class="icon-edit bigger-120"></i>
                                                    </span>
                                                </a>
                                            </li>';

		}
		if ($model->detail !== false) {
			$detailButton = '
                                    <a href="{:U(detail, [\'id\'=>$vo[\'id\']])}">
                                        <button class="btn btn-xs btn-warning" style="border: 1px;">
                                            <i class="icon-search" style="margin-right: 0px;"></i>
                                        </button>
                                    </a>';
			$wapDetailButton = '
                                            <li>
                                                <a href="{:U(detail, [\'id\'=>$vo[\'id\']])}" class="tooltip-success" data-rel="tooltip" title="Edit">
                                                    <span class="yellow">
                                                        <i class="icon-search bigger-120"></i>
                                                    </span>
                                                </a>
                                            </li>';

		}

		$tableOpeationButton = $this->tableOpeationButton();
		$wapTableOpeationButton = $this->wapTableOpeationButton();
		$endView = '
                            <td class="center">
                                <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">'
            . $tableOpeationButton
            . $detailButton
            . $updateButton
			. $deleteButton . '
                                </div>
                                <div class="visible-xs visible-sm hidden-md hidden-lg">
                                    <div class="inline position-relative">
                                        <button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown">
                                            <i class="icon-cog icon-only bigger-110"></i>
                                        </button>
                                        <ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">' 
            . $wapTableOpeationButton
            . $wapDetailButton
            . $wapUpdateButton
			. $wapDeleteButton . '
                                        </ul>
                                    </div>
                                </div>
                            </td>';
		$endView .= '
                        </tr>
                    </volist>
                </tbody>
            </table>
            {$page}
        </div><!-- /.table-responsive -->
    </div><!-- /span -->
</div><!-- /row -->
<include file="Public/ace_footer" />';
		return $endView;
	}


	//UPDATE
	public function updateStart($model) {
		//文件上传表单enctype
		$fileStr = '';
		foreach ($model->fieldMap as $field => $param) {
			if ($param['type'] == 'file') {
				$fileStr = 'enctype="multipart/form-data"';
			}
		}
		$updateView = '
<include file="Public/ace_header" />
    <div class="row">
        <form class="form-horizontal" role="form" method="post" ' . $fileStr . ' style="padding-left: 10px;padding-right: 10px;">';
		return $updateView;
	}
	public function updatePassword($field, $param) {
		$inputView = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="' . $field . '"> ' . $param['name'] . ' </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <input type="password" class="width-100" placeholder="' . $param['name'] . '" id="' . $field . '" name="' . $field . '"  value="{$model[\'' . $field . '\']|default=\'\'}" ' . $param['require'] . ' ' . $param['readonly'] . '/>
                        <i class=""></i>
                        <small style="color:gray;">'.$param['tips'].'</small>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>';
		return $inputView;
	}
	public function updateInput($field, $param) {
		$inputView = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="' . $field . '"> ' . $param['name'] . ' </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <input type="text" class="width-100" placeholder="' . $param['name'] . '" id="' . $field . '" name="' . $field . '"  value="{$model[\'' . $field . '\']|default=\'\'}" ' . $param['require'] . ' ' . $param['readonly'] . '/>
                        <i class=""></i>
                        <small style="color:gray;">'.$param['tips'].'</small>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>';
		return $inputView;
	}

	public function updateDate($field, $param) {
		$dateView = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="' . $field . '"> ' . $param['name'] . ' </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <input type="text" class="width-100" placeholder="' . $param['name'] . '" id="' . $field . '" name="' . $field . '"  value="{$model[\'' . $field . '\']|default=\'\'|date=\'Y-m-d\',###}" ' . $param['require'] . ' onClick="WdatePicker()" readonly=""/>
                        <i class=""></i>
                        <small style="color:gray;">'.$param['tips'].'</small>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>';
		return $dateView;
	}

	public function updateDatetime($field, $param) {
		$datetimeView = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="' . $field . '"> ' . $param['name'] . ' </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <input type="text" class="width-100" placeholder="' . $param['name'] . '" id="' . $field . '" name="' . $field . '"  value="{$model[\'' . $field . '\']|default=\'\'|date=\'Y-m-d H:i:s\',###}" ' . $param['require'] . ' onClick="WdatePicker({dateFmt:\'yyyy-MM-dd HH:mm:ss\'})" readonly=""/>
                        <i class=""></i>
                        <small style="color:gray;">'.$param['tips'].'</small>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>';
		return $datetimeView;
	}

	public function updateTextarea($field, $param) {
		$inputView = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="' . $field . '"> ' . $param['name'] . ' </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <textarea class="col-xs-12 col-sm-6 width-100" style="padding: 5px 4px;" rows="5" id="' . $field . '" name="' . $field . '" placeholder="' . $param['name'] . '" ' . $param['require'] . ' ' . $param['readonly'] . '>{$model["' . $field . '"]|default=\'\'}</textarea>
                        <i class=""></i>
                        <small style="color:gray;">'.$param['tips'].'</small>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>';
		return $inputView;
	}

	public function updateUeditor($field, $param) {
		$ueditorView = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="' . $field . '"> ' . $param['name'] . ' </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <textarea class="col-xs-12 col-sm-6 width-100" style="padding: 5px 4px;" rows="5" id="' . $field . '" name="' . $field . '" placeholder="' . $param['name'] . '" ' . $param['require'] . ' ' . $param['readonly'] . '>{$model["' . $field . '"]|default=""}</textarea>
                        <i class=""></i>
                        <small style="color:gray;">'.$param['tips'].'</small>
                    </span>
                </div>
                <script type="text/javascript">var editor = UE.getEditor("' . $field . '");</script>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>';
		return $ueditorView;
	}
	public function updateFile($field, $param) {
		//file的content img,100,200 //图片/文件 宽 高
		$imgStr = ''; //img类型，update时显示图片,create时不显示
		$fileContent = explode(',', $param['content']);
		if (($fileContent[0] == 'img') OR (!$fileContent[0])) {
			if (!$fileContent[1]) {
				$imgWidth = "120";
			} else {
				$imgWidth = $fileContent[1];
			}
			if (!$fileContent[2]) {
				$imgHeight = "60";
			} else {
				$imgHeight = $fileContent[2];
			}
			$imgStr = '<img src="__PUBLIC__/file/{$model[\''.$field.'\']}" width="'.$imgWidth.'" height="'.$imgHeight.'" />';
		}
		$fileView = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="' . $field . '"> ' . $param['name'] . ' </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <input type="file" class="width-100" placeholder="' . $param['name'] . '" id="' . $field . '" name="' . $field . '"  value="{$model[\'' . $field . '\']|default=\'\'}" ' . $param['require'] . ' ' . $param['readonly'] . '/>
                        <i class=""></i>
                        <small style="color:gray;">'.$param['tips'].'</small>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
            </div>
            <if condition="ACTION_NAME eq update">
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="imgShow"></label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                    	'.$imgStr.'
                        <i class=""></i>
                        <small style="color:gray;">'.$param['tips'].'</small>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
            </div>
            </if>
            ';
		return $fileView;
	}

	/**
	 * 根据表名获取到model名
	 */
	public function getModelNameByTableName($tableName) {
		$tableNames = explode('_', $tableName);
		$modelName = '';
		foreach ($tableNames as $tableName) {
			$modelName .= ucfirst($tableName);
		}
		return $modelName;
	}

	public function updateForeign($field, $param) {
		//获取foreignModel信息
		$foreignArr = explode(',', $param['content']);
		$foreignModel = $this->getModelNameByTableName($foreignArr[0]);
		$optionContent = '
                            <php> $' . $foreignArr[0] . ' = D(' . $foreignModel . ')->select(); </php>
                            <volist name="' . $foreignArr[0] . '" id="vo">
                            <option value="{$vo[\'' . $foreignArr[1] . '\']}" <if condition ="$model[\'' . $field . '\'] eq $vo[\'' . $foreignArr[1] . '\']"> selected </if>>{$vo[\'' . $foreignArr[2] . '\']}</option>
                            </volist>';
		$foreignView = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="' . $field . '"> ' . $param['name'] . ' </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <select name="' . $field . '" id="' . $field . '" class="width-100" ' . $param['readonly'] . '>' . $optionContent . '
                        </select>
                        <i class=""></i>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>';
		return $foreignView;
	}

	public function updateSelect($field, $param) {
		$options = explode(',', $param['content']);
		$optionContent = '';
		foreach ($options as $option) {
			$optionContent .= '
                             <option value="' . $option . '" <if condition ="$model[\'' . $field . '\'] eq \'' . $option . '\'"> selected </if> >' . $option . '</option>';
		}
		$selectView = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="' . $field . '"> ' . $param['name'] . ' </label>
                <div class="col-xs-12 col-sm-6">
                    <span class="block input-icon input-icon-right">
                        <select name="' . $field . '" id="' . $field . '" class="width-100" ' . $param['readonly'] . '>' . $optionContent . '
                        </select>
                        <i class=""></i>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
             </div>';
		return $selectView;
	}

	public function updateEnd() {
		$endView .= '
            <div class="clearfix form-actions">
                <div style="margin-left: 25%;">
                    <button class="btn btn-info btn-sm" type="submit">
                        <i class="icon-ok bigger-110"></i>
                        提交
                    </button>
                    &nbsp; &nbsp; &nbsp;
                    <button class="btn btn-sm return" type="button">
                        <i class="icon-reply bigger-110"></i>
                        返回
                    </button>
                </div>
            </div>
        </form>
    </div>
<include file="Public/ace_footer" />';
		return $endView;
	}

	public function updateOption($field, $param) {
		if ($param['input'] === false) {
			return '';
		} elseif ($param['input'] === true) {
			$readonlyStr = '';
		} elseif ($param['input'] === 'create') {
			$readonlyStr = '<if condition="ACTION_NAME eq update">readonly</if>';
		} elseif ($param['input'] === 'update') {
			$readonlyStr = '<if condition="ACTION_NAME eq create">readonly</if>';
		}
		$param['readonly'] = $readonlyStr;
		//必填
		$requireStr = '';
		if ($param['required'] !== false) {
			$requireStr = 'validate-required="required:请填写' . $param['name'] . '"';
			$param['require'] = $requireStr;
		}
		$updateOption = 'update' . ucfirst($param['type']);
		if ($param['update_specify'] != '') {
			$updateView = $param['update_specify'];
		} else {
			$updateView = $this->$updateOption($field, $param);
		}
		return $updateView;
	}


	public function detailOption($field, $param) {
		if ($param['detail'] === false) {
			return '';
		}
		if ($param['detail_specify'] != '') {
			$detailView = $param['detail_specify'];
			return $detailView;
		}

		if (($param['type'] == 'input') || ($param['type'] == 'textarea') || ($param['type'] == 'select')) {
			$detailView = '
                <tr>
                    <td class="center" width="20%">' . $param['name'] . '</td>
                    <td class="center">{$detail["' . $field . '"]}</td>
                </tr>';
		} elseif ($param['type'] == 'ueditor') {
			$detailView = '
                <tr>
                    <td class="center" width="20%">' . $param['name'] . '</td>
                    <td class="center">{$detail["' . $field . '"]|html_entity_decode}</td>
                </tr>';
		} elseif ($param['type'] == 'file') {
			//file的content img,100,200 //图片/文件 宽 高
			$fileStr = '{$detail[\''.$field.'\']}'; //img类型，update时显示图片,create时不显示
			$fileContent = explode(',', $param['content']);
			if (($fileContent[0] == 'img') OR (!$fileContent[0])) {
				if (!$fileContent[1]) {
					$imgWidth = "120";
				} else {
					$imgWidth = $fileContent[1];
				}
				if (!$fileContent[2]) {
					$imgHeight = "60";
				} else {
					$imgHeight = $fileContent[2];
				}
				$fileStr = '<img src="__PUBLIC__/file/{$detail[\''.$field.'\']}" width="'.$imgWidth.'" height="'.$imgHeight.'" />';
			}
			$detailView = '
                <tr>
                    <td class="center" width="20%">' . $param['name'] . '</td>
                    <td class="center">'.$fileStr.'</td>
                </tr>';
		} elseif ($param['type'] == 'date') {
			$detailView = '
                <tr>
                    <td class="center" width="20%">' . $param['name'] . '</td>
                    <td class="center">{$detail["' . $field . '"|date="Y-m-d",###]}</td>
                </tr>';
		} elseif ($param['type'] == 'datetime') {
			$detailView = '
                <tr>
                    <td class="center" width="20%">' . $param['name'] . '</td>
                    <td class="center">{$detail["' . $field . '"|date="Y-m-d H:i:s",###]}</td>
                </tr>';
		} elseif ($param['type'] == 'foreign') {
			$foreignArr = explode(',', $param['content']);
			$foreignModel = $this->getModelNameByTableName($foreignArr[0]);
			$detailView = '
                <tr>
                    <td class="center" width="20%">' . $param['name'] . '</td>
                    <td class="center"><php> echo D(' . $foreignModel . ')->where(["' . $foreignArr[1] . '"=>$detail[' . $field . ']])->find()["' . $foreignArr[2] . '"]; </php></td>
                </tr>';
		}
		return $detailView;
	}

	public function detailStart() {
		$detailView = '
<include file="Public/ace_header" />
<div class="row">
    <div class="col-xs-12">
        <div class="table-responsive">
            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                <if condition="detail[name]">
                <thead>
                    <tr>
                        <th class="center" colspan="2">{$detail["name"]}信息</th>
                    </tr>
                </thead>
                </if>
                <tbody>';
		return $detailView;
	}

	public function detailEnd() {
		$detailView = '
                </tbody>
            </table>
            <div class="clearfix form-actions">
                <div style="margin-left: 40%;">
                    <button class="btn btn-sm return" type="button">
                        <i class="icon-reply bigger-110"></i>
                        返回
                    </button>
                </div>
            </div>

        </div>
    </div>
</div>
<include file="Public/ace_footer" />';
		return $detailView;
	}


	public function importContent() {
		$importContent = '
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right" for="import"> 文件 </label>
                <div class="col-xs-12 col-sm-6">
                        <span class="block input-icon input-icon-right" style="padding-top: 6px;">
                        <input type="file" class="width-100"  id="import" name="import" validate-required="required:请选择需要导入的文件"/>
                        <i class=""></i>
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline" style="margin-bottom: 5px;"></div>
            </div>';
		return $importContent;
	}
}
